/**
 * Created by kevin on 2016/9/27.
 * 首页
 */
var eosi = window.eosi || {};
this.eosi.website = this.eosi.website || {};


(function (window) {
    function Loading(father) {
        this.Container_constructor();
        this.father = father;

        this.init();
    }

    

    var p = createjs.extend(Loading, createjs.Container);
    p.father;
    p.loadingResLoader;
    p.config=loading_page["numberSet"];
    // p.resItems;

    p.init = function () {
        this.bg= new createjs.Container();
        this.addChild(this.bg);
        this.loadingresLoadComplete();
    }
    // p.loadLoadingRes = function () {
    //     alert(1);
    //     this.loadingResLoader = new createjs.LoadQueue(true);
    //     this.loadingResLoader.on("fileload", this.onLoaded, this);
    //     this.loadingResLoader.on("complete", this.loadingresLoadComplete, this);
    //     this.loadingResLoader.on("progress", this.loadingresOnProgress, this);
    //     this.loadingResLoader.loadManifest({src: "./static/load/PageLoadManifest.json?v="+version, callback: "loadPageLoadMediaGrid", type: "manifest"}, true, "./");
    // }
    p.loadingresLoadComplete = function (event) {
        console.log(event);
        // var sb = new createjs.Text("sb", "12px Arial", "#555");
        // this.bg.addChild(sb);
        this.page = new eosi.website.BasePage({
            "id": "create_load",
            "name":"create_load",
            "src": BASE_PATH + "static/load/PageLoadManifest.json",
            "callback":"loadPageLoadMediaGrid",
            "p_type": {"type":"default"},
            "loading":"global",
            "reload_type":"animation",
            "preload":true,
            "button_on":"menu_icon_0",
        });
        this.page.name = "create_load";
        this.page.pageIndex = 0;
        // this.page.loader=this.loadingResLoader;
        // this.draw_number("123");
        this.addChild(this.page);
        
    }
    p.onLoaded = function (evt){
        // var item = evt.item;
        // this.resItems.push(item);
    }
    p.loadingresOnProgress = function (event) {
        // var loading_loaded = this.loadingResLoader.progress * 100 | 0;
        // this.drawLoadingNum(Math.floor(loading_loaded*0.1));
    }
    p.draw_number=function(per){
       

        if(this.loadingNumHolder==null){
            this.loadingNumHolder = new createjs.Container();
            this.addChild(this.loadingNumHolder);
            this.loadingNumHolder.y=targetHeight*this.config["y"];
        }
        this.loadingNumHolder.removeAllChildren();
        
        var number = new createjs.Text(this.config["textfirst"]+per+this.config["textafter"],this.config["font"],this.config["color"]);
        number.textAlign = "center";
        // num_pic.y=-30/ratio;
        this.loadingNumHolder.addChild(number);
        this.loadingNumHolder.x=targetWidth*this.config["x"];
    }

    p.tick = function (evt) {
        
    }


    // add MyApp to myNameSpace
    window.eosi.website.Loading = createjs.promote(Loading, "Container");
//}());
}(window));



